package loan.calc.domain;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import loan.calc.constant.dict.CurrencyDictEnum;
import loan.calc.constant.dict.DirectionTypeEnum;
import loan.calc.constant.dict.RepayScheduleTypeEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;

/**
 * @author v_ECD963
 */
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
@Accessors(chain = true)
@NoArgsConstructor
@TableName("loan_repayment_schedule")
@Schema(description = "借据还款计划实体", name = "LoanRepaymentScheduleDO", title = "借据还款计划")
public class LoanRepaymentScheduleDO extends BaseEntity implements Serializable {
    /**
     * id
     */
    @TableId
    @Schema(description = "借据还款计划编号")
    private Long scheduleId;

    /**
     * 借据id
     */
    @Schema(description = "借据编号")
    private Long loanId;

    @Schema(description = "还款区段编号")
    private Long repaySegmentId;

    @Schema(description = "还款计划类型/偿付类型")
    private RepayScheduleTypeEnum repayScheduleType;

    /**
     * 期次
     */
    @Schema(description = "期次")
    private Integer periodNo;

    /**
     * 应还日期
     */
    @Schema(description = "应还日期")
    private LocalDate paymentDate;

    /**
     * 节假日及宽限期顺延后的还款日期
     */
    @Schema(description = "节假日及宽限期顺延后的还款日期")
    private LocalDate delayedPaymentDate;

    /**
     * 结清日期
     */
    @Schema(description = "结清日期")
    private LocalDate finishDate;

    /**
     * 币种
     */
    @Schema(description = "币种")
    private CurrencyDictEnum currency;

    /**
     * 收付方向
     */
    @Schema(description = "收付方向")
    private DirectionTypeEnum direction;

// =======================基本三个一组：应该；实还；减免=================================
    /**
     * 本金
     */
    @Schema(description = "应还本金")
    private BigDecimal payPrincipalAmt;
    @Schema(description = "实还本金")
    private BigDecimal actualPayPrincipalAmt;
    @Schema(description = "减免本金")
    private BigDecimal waivePrincipalAmt;
    /**
     * 剩余本金余额
     */
    @Schema(description = "本金余额")
    private BigDecimal principalBalance;

    /**
     * 利息
     */
    @Schema(description = "应还利息")
    private BigDecimal payInterestAmt;
    @Schema(description = "实还利息")
    private BigDecimal actualPayInterestAmt;
    @Schema(description = "减免利息")
    private BigDecimal waiveInterestAmt;

    /**
     * 本金罚息
     */
    @Schema(description = "应还本金罚息")
    private BigDecimal payPrincipalPenaltyAmt;
    @Schema(description = "实还本金罚息")
    private BigDecimal actualPayPrincipalPenaltyAmt;
    @Schema(description = "减免本金罚息")
    private BigDecimal waivePrincipalPenaltyAmt;

    /**
     * 利息罚息（复利）
     */
    @Schema(description = "应还利息罚息（复利）")
    private BigDecimal payInterestPenaltyAmt;
    @Schema(description = "实还利息罚息（复利）")
    private BigDecimal actualPayInterestPenaltyAmt;
    @Schema(description = "减免利息罚息（复利）")
    private BigDecimal waiveInterestPenaltyAmt;

}
